package systemClasses;

import java.util.GregorianCalendar;

public class Item {
	
	private String name;
	private String description;
	private String category;
	private String iD;
	private String idRequisition;
	private String idLoan;
	private int requisitionDuration;
	private String status;
	private User owner;
	private User borrower;
	private GregorianCalendar dateOfLoan;
	
	public Item(String name, String description, String category) throws Exception{
		setName(name);
		setDescription(description);
		setCategory(category);
	}
	
	public void setName(String name) throws Exception{
		if(name == null || name.equals(""))
			throw new Exception("Nome inválido");
		
		this.name = name;
	}
	
	public void setDescription(String description) throws Exception{
		if(description == null || description.equals(""))
			throw new Exception("Descrição inválida");
		
		this.description = description;
	}
	
	public void setCategory(String category) throws Exception{
		if(category == null || category.equals(""))
			throw new Exception("Categoria inválida");
		
		this.category = category;
	}
	
	public void setID(String iD) throws Exception{
		if(iD == null || iD.equals(""))
			throw new Exception("Identificação inválida");
		
		this.iD = iD;
	}
	
	public void setIdRequisition(String idRequisition) throws Exception{
		if(idRequisition == null || idRequisition.equals(""))
			throw new Exception("Identificação inválida");
		
		this.idRequisition = idRequisition;
	}
	
	public void setRequisitionDuration(int requisitionDuration) throws Exception{
		if(requisitionDuration < 0)
			throw new Exception("Duração inválida");
		
		this.requisitionDuration = requisitionDuration;
	}
	
	public void setIDLoan(String idLoan) throws Exception{
		if(idLoan == null || idLoan.equals(""))
			throw new Exception("Identificação inválida");
		
		this.idLoan = idLoan;
	}
	
	public void setOwner(User owner) throws Exception{
		if(owner == null)
			throw new Exception("Usuário inválido");
		
		this.owner = owner;
	}
	
	public void setBorrower(User borrower) throws Exception{
		if(owner == null)
			throw new Exception("Usuário inválido");
		
		this.borrower = borrower;
	}
	
	public void setStatus(String status) throws Exception{
		if(status == null || status.equals(""))
			throw new Exception("Status inválido");
		
		this.status = status;
	}
	
	public void setDateOfLoan(GregorianCalendar dateOfLoan){
		this.dateOfLoan = dateOfLoan;
	}
	
	public String getName(){
		return name;
	}
	
	public String getDescription(){
		return description;
	}
	
	public String getCategory(){
		return category;
	}
	
	public String getID(){
		return iD;
	}
	
	public String getIdRequisition(){
		return idRequisition;
	}
	
	public String getIdLoan(){
		return idLoan;
	}
	
	public int getRequisitionDuration(){
		return requisitionDuration;
	}
	
	public User getOwner(){
		return owner;
	}
	
	public User getBorrower(){
		return borrower;
	}
	
	public String getStatus(){
		return status;
	}
	
	public GregorianCalendar getDateOfLoan(){
		return dateOfLoan;
	}
}